﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using qlHieuThuocDongY.DataAccess;

namespace qlHieuThuocDongY
{
    public partial class frmTimKiemThuocNhapVao : Form
    {
        public frmTimKiemThuocNhapVao()
        {
            InitializeComponent();
        }
        ConnectData conn = new ConnectData();
        private void btnSearch_Click(object sender, EventArgs e)
        {
           
            if (txtNhapTimKiemThuocNhap.Text.Length == 0)
                dataGridViewTimKiemThuocNhapVao.DataSource = conn.GetDataTable("Select * from NhapThuoc");
            else if (rdMaThuoc.Checked)
                dataGridViewTimKiemThuocNhapVao.DataSource = conn.GetDataTable("Select * from NhapThuoc where MaThuoc='" + txtNhapTimKiemThuocNhap.Text + "'");
            else if (rdMaNCC.Checked)
                dataGridViewTimKiemThuocNhapVao.DataSource = conn.GetDataTable("Select * from NhapThuoc where MaNCC='" + txtNhapTimKiemThuocNhap.Text + "'");
            else
                dataGridViewTimKiemThuocNhapVao.DataSource = conn.GetDataTable("Select * from NhapThuoc where MaHDNhap='" + txtNhapTimKiemThuocNhap.Text + "'");
        }

        private void frmTimKiemThuocNhapVao_Load(object sender, EventArgs e)
        {
            dataGridViewTimKiemThuocNhapVao.DataSource = conn.GetDataTable("Select * from NhapThuoc");

        }
    }
}
